#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

class Node_t {
public:
    Node_t();
    Node_t(int data):val(data){}
    int val;
    vector<Node_t *> child;
};


void writeTree(Node_t *root, ofstream &out)
{
    char ch = 'a' + root->val - 1;
    out << ch << " ";
    for (int i = 0; i < root->child.size(); i++) {
        writeTree(root->child[i], out);    
    }
    out << "#" << " ";
}

int main(int argc, char **argv)
{
    ofstream out("tree.out");
    map<int, Node_t *> myMap;
    for (int i = 1; i <= 15; i++) {
        Node_t *newNode = new Node_t(i);
        myMap[i] = newNode;    
    }
    
    myMap[1]->child.push_back(myMap[2]);
    myMap[1]->child.push_back(myMap[3]);
    myMap[1]->child.push_back(myMap[4]);
    myMap[2]->child.push_back(myMap[5]);
    myMap[2]->child.push_back(myMap[6]);
    myMap[2]->child.push_back(myMap[7]);
    myMap[7]->child.push_back(myMap[8]);
    myMap[7]->child.push_back(myMap[9]);
    myMap[4]->child.push_back(myMap[10]);
    myMap[4]->child.push_back(myMap[11]);
    myMap[11]->child.push_back(myMap[12]);
    myMap[11]->child.push_back(myMap[13]);
    myMap[13]->child.push_back(myMap[14]);
    myMap[14]->child.push_back(myMap[15]);

    writeTree(myMap[1], out);
    out.close();
}
